package com.template.server.common.config;

import com.template.server.common.exception.SystemErrorException;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author liuxf
 * @date 2024/4/12
 * spring mvc配置
 */
@Configuration
public class WebAppMvcConfig implements WebMvcConfigurer {

    @Bean
    public ErrorViewResolver errorViewResolver() {
        return (request, status, model) -> {
            throw new SystemErrorException("Sorry！", status.value());
        };
    }

}
